/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef DRAWING_BENCH_DEMO_DRAW_LINE_H
#define DRAWING_BENCH_DEMO_DRAW_LINE_H
#include "drawing_bench_test_base.h"

namespace OHOS {
namespace Rosen {
class DrawLineTest : public TestBase {
public:
    DrawLineTest() : TestBase() {}
    virtual ~DrawLineTest() = default;

protected:
    // void OnTestFunction(Drawing::Canvas* canvas) override;
    void OnTestPerformance(Drawing::Canvas* canvas) override
    {
        Drawing::Brush brush;
        brush.SetColor(0xFFFF0000);
        canvas->AttachBrush(brush);
        auto p1 = Drawing::Point(360,640);
        auto p2 = Drawing::Point(360,640);
        double r =200.0;
        double x,y,angle;
        auto rect = Drawing::Rect(0, 0, 100, 100);
        for (int i = 0; i < testCount_; i++) {
            angle = (i%360)/1.0 /180.0 *3.1415926;
            x = 360 + r*std::cos(angle);
            y = 640 + r*std::sin(angle);
            // cout<<"x="<<x<<" y="<<y<<endl;
            p2 = Drawing::Point(x,y);
            canvas->DrawLine(p1,p2);
        }
    }
};
} // namespace Rosen
} // namespace OHOS
#endif // DRAWING_BENCH_DEMO_DRAW_LINE_H